package com.kata.chapter12;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * 事物抽象类
 * Created by Solidsnake on 2014/12/4.
 */
public abstract class Transaction {

    protected IConnection connection;

    public Transaction(IConnection connection) {
        this.connection = connection;
    }


    protected abstract void before();

    protected abstract void after();

    public void runingTransaction()  {
        before();
        connection.commit();
        after();
    }

}
